import Hero from '../../components/hero'
import { cookies } from 'next/headers'
import { fetcher } from '@/src/utils/fetcher'
import ScrollToTop from '../../components/scroll-to-top'

interface LayoutProps {
  children: React.ReactNode
}

const Layout: React.FC<LayoutProps> = async (props) => {
  const { children } = props
  const cookieStore = cookies()
  const sliders = await fetcher<Slider[]>('/api/index/adList?type=product', {
    cookieStore,
  })
  return (
    <main>
      <ScrollToTop />
      <Hero sliders={sliders} />
      {children}
    </main>
  )
}

export default Layout
